package ManHinhChinh;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

public class ThemKhachHang {

	protected Shell shlThmKhchHng;
	private Text txtTKH_MaKhacHang;
	private Text txtTKH_HoTen;
	private Text txtTKH_DiaChi;
	private Text txtTKH_DienThoai;
	private Text txtTKH_Email;

	
	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		createContents();
		shlThmKhchHng.open();
		shlThmKhchHng.layout();
		while (!shlThmKhchHng.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 * @wbp.parser.entryPoint
	 */
	protected void createContents() {
		shlThmKhchHng = new Shell();
		shlThmKhchHng.setSize(380, 316);
		shlThmKhchHng.setText("Th\u00EAm Kh\u00E1ch H\u00E0ng");
		
		Label lblNewLabel = new Label(shlThmKhchHng, SWT.NONE);
		lblNewLabel.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.NORMAL));
		lblNewLabel.setBounds(41, 27, 113, 19);
		lblNewLabel.setText("M\u00E3 Kh\u00E1ch H\u00E0ng");
		
		Label lblHTn = new Label(shlThmKhchHng, SWT.NONE);
		lblHTn.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.NORMAL));
		lblHTn.setText("H\u1ECD T\u00EAn");
		lblHTn.setBounds(41, 67, 55, 19);
		
		Label lblaCh = new Label(shlThmKhchHng, SWT.NONE);
		lblaCh.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.NORMAL));
		lblaCh.setText("\u0110\u1ECBa Ch\u1EC9");
		lblaCh.setBounds(41, 103, 55, 26);
		
		Label lblinThoi = new Label(shlThmKhchHng, SWT.NONE);
		lblinThoi.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.NORMAL));
		lblinThoi.setText("\u0110i\u1EC7n Tho\u1EA1i");
		lblinThoi.setBounds(41, 145, 77, 19);
		
		Label lblEmail = new Label(shlThmKhchHng, SWT.NONE);
		lblEmail.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.NORMAL));
		lblEmail.setText("Email");
		lblEmail.setBounds(41, 183, 55, 26);
		
		Button btnNewButton = new Button(shlThmKhchHng, SWT.NONE);
		btnNewButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				String a = txtTKH_MaKhacHang.getText().trim();
				String b = txtTKH_HoTen.getText().trim();
				String c = txtTKH_DiaChi.getText().trim();
				String d = txtTKH_DienThoai.getText().trim();
				String f = txtTKH_Email.getText().trim();
				ConnectSQL cn= new ConnectSQL();
				cn.GhiThemKhachHang(a, b, c, d, f);
			}
		});
		btnNewButton.setFont(SWTResourceManager.getFont("Times New Roman", 14, SWT.NORMAL));
		btnNewButton.setBounds(124, 227, 113, 40);
		btnNewButton.setText("Th\u00EAm");
		
		txtTKH_MaKhacHang = new Text(shlThmKhchHng, SWT.BORDER);
		txtTKH_MaKhacHang.setBounds(175, 27, 163, 21);
		
		txtTKH_HoTen = new Text(shlThmKhchHng, SWT.BORDER);
		txtTKH_HoTen.setBounds(175, 67, 163, 21);
		
		txtTKH_DiaChi = new Text(shlThmKhchHng, SWT.BORDER);
		txtTKH_DiaChi.setBounds(175, 103, 163, 21);
		
		txtTKH_DienThoai = new Text(shlThmKhchHng, SWT.BORDER);
		txtTKH_DienThoai.setBounds(175, 143, 163, 21);
		
		txtTKH_Email = new Text(shlThmKhchHng, SWT.BORDER);
		txtTKH_Email.setBounds(175, 188, 163, 21);

	}

}
